package com.sn.system.tangs.tag;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.components.UIBean;
import org.apache.struts2.views.annotations.StrutsTag;
import org.apache.struts2.views.annotations.StrutsTagAttribute;

import com.opensymphony.xwork2.util.ValueStack;

@StrutsTag(name = "fielderror", tldTagClass = "jp.co.sn.system.tangs.tag.FieldErrorTag", description = "fielderror")
public class FieldError extends UIBean{
	public FieldError(ValueStack stack, HttpServletRequest request,
			HttpServletResponse response) {
		super(stack, request, response);
	}
	private String successTopics;
	
	private String okButtonId;
	
	protected String getDefaultTemplate() {
		return "sn_fielderror";
	}
	
	@StrutsTagAttribute(description = "set successTopics", type = "String")
	public void setSuccessTopics(String successTopics) {
		this.successTopics = successTopics;
	}

	@StrutsTagAttribute(description = "set okButtonId", type = "String")
	public void setOkButtonId(String okButtonId) {
		this.okButtonId = okButtonId;
	}

	/**
	 * パラメータを設定する
	 */
	protected void evaluateExtraParams() {
		super.evaluateExtraParams();
		if (null != successTopics) {
			addParameter("successTopics", findString(successTopics));
		}
		if (null != okButtonId) {
			addParameter("okButtonId", findString(okButtonId));
		}
	}	
}
